package com.headingdata.operator;

public class OperatorDemo3 {
    public static void main(String[] args) {
        //逻辑运算符的使用
        //需求：检索手机尺寸大于等于6.8且内存大于等于8
        double size = 5.6;
        int storage = 12;
        boolean res = size >= 6.8 & storage >= 8;
        System.out.println(res);

        //需求：检索手机尺寸大于等于6.8或内存大于等于8
        boolean res1 = size >= 6.8 | storage >=8;
        System.out.println(res1);

        System.out.println(!true);
        System.out.println(!false);
        System.out.println(!(2>1));

        System.out.println(false^false);//false
        System.out.println(false^true);//true
        System.out.println(true^true);//false

        // && ||
        int i = 10;
        int j = 20;
        System.out.println(i > 100 && j++ > 90);
        System.out.println(j);

        System.out.println(i > 9 || ++j > 21);
        System.out.println(j);
    }
}
